package com.vidmt.api.modules.sys.service;

import java.util.List;

import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageInfo;
import com.thinkgem.jeesite.common.service.CrudService;
import com.vidmt.api.modules.sys.dao.PropertyDao;
import com.vidmt.api.modules.sys.entity.Property;

/**
 * 系统属性Service
 * 
 * @author xingqisheng
 * @version 2015-08-14
 */
@Service
@Transactional(readOnly = false)
@CacheConfig(cacheNames = "sysCache")
public class PropertyService extends CrudService<PropertyDao, Property> {
	@Transactional(readOnly = true)
	public Property get(String id) {
		return dao.get(id);
	}

	@Transactional(readOnly = true)
	@Cacheable(key = "'prop_key_'+#key")
	public String getValue(String key) {
		return dao.getValue(key);
	}

	@Transactional(readOnly = true)
	public List<Property> findList(Property sysProp) {
		return super.findList(sysProp);
	}

	@Transactional(readOnly = true)
	public PageInfo<Property> findPage(Integer pageNum,Integer pageSize, Property sysProp) {
		return super.findPage(pageNum,pageSize, sysProp);
	}

	@Override
	@CacheEvict(key = "'prop_key_'+#entity.key")
	public void saveOrUpdate(Property entity) {
		super.saveOrUpdate(entity);
	}
}